package sige

class DadosDoUsuarioController {

    def index() { }
    
    def show(Long id){
        def user = Usuario.get(id)
        
        [usuarioInstance : user]
    }
    
    def edit(){
        def user = Usuario.get(session.usuario.id)
        if(!user){
            return redirect(controller: 'login')
        }
        [usuarioInstance : user]
    }
    
    def update(){
        def user = Usuario.get(session.usuario.id)
        if(!user){
            return redirect(controller: 'login')
        }
        user.properties = params
        if( !user.save(flush: true) ){
            return redirect( action: 'edit' , model:[usuarioInstance : user] )
        }
        DadosDoUsuarioService ddus = new DadosDoUsuarioService()
        upload(alunoInstance , request)
        redirect (action: 'show')
    }
}
